﻿using System;
using System.Diagnostics;
using System.IO;

namespace HmLab.Func2;

internal class LbPrepareMonthOut {

  /// <summary>
  /// PrepareOut
  /// <see cref="Haimen.Func2.MonthResultMaker"/>
  /// <see cref="Program.Main"/>
  /// </summary>
  public void Run() {
    Console.WriteLine("TODO:LbPrepareMonthOutLbPrepareMonthOutLbPrepareMonthOut");

    string devDir = @"E:\work_etc\nina\2023haimen2\workshop_cslab\输O入func2b\输O入\dev";
    string resDir = @"E:\work_etc\nina\2023haimen2\workshop_cs\haimen\resources\func2";
    string outDir = @"E:\work_etc\nina\2023haimen2\workshop_cslab\输Q出f2";

    const string result = "month.xlsx";
    var ResolveTpl = () => {
      string devTpl = Path.Join(devDir, result);
      if (File.Exists(devTpl)) {
        return devTpl;
      }

      string resTpl = Path.Join(resDir, result);
      Debug.Assert(File.Exists(resTpl));
      return resTpl;
    };

    string outPath = Path.Join(outDir, "月合并报表.xlsx");
    string tplPath = ResolveTpl();
    //Console.WriteLine(tplPath);

    File.Copy(tplPath, outPath, overwrite: true);
  }
}
